Updated on Aug 16, 2019
There is a specific issue that can occur while trying to move newly uploaded files to your WordPress website. It says:
“The uploaded file cannot be moved to wp-content/(the upload folder)”
An extra side effect of this error is the fact that you cannot update existing plugins automatically, or add some new ones. If you try, for example, adding a new plugin, WordPress will present you with an FTP credentials screen for you to upload the new plugin manually.
In this post, we will cover:
What Causes The Image Upload Issue in WordPress?Changing the File/Folder Permissions is a Bad AdviceFixing the Upload Issue in WordPressFixing "Upload folder is not writable" in WordPressFixing "The uploaded file cannot be moved to wp-content/(the upload folder)" via the cPanel TerminalWhat Causes The Image Upload Issue in WordPress?Let’s say you have a migrated WordPress site that was working correctly with your previous host. In that case, the issue with an error message “The uploaded file cannot be moved to wp-content/(the upload folder)” is happening most likely because WordPress passes off the uploading of your requested file to the web server process on which your site resides. The process receives the image from your hard drive and uploads it to the server’s temporary memory.
Then, WordPress tries to commit your file into the storage of the media library, and there comes the error. The account that is actually retrieving your file is none other than the Apache Service Account (aka the Nobody account) on the server itself. You get the error message because that particular account has no rights to the /wp-content/uploads// folder. The message indicates that there was an issue placing your file in the specific folder. This comes by design, and it means that your web server is enforcing the security parameters that it’s supposed to, which is definitely not a bad thing.
Changing the File/Folder Permissions is a Bad AdviceThe Internet is full of recommendations on how to fix the issue. Most of them suggest resolving the problem by changing the permissions on the folder /wp-content/uploads to 777. This is not a good idea. It will fix your issue, but your folder’s availability will be changed. In short, the 777 permission means making the file/folder readable, writable and executable by everyone. For security reasons, better go with another method and actually resolve the issue as it’s supposed to be done.
Fixing the Upload Issue in WordPressThere are two possibilities when facing the upload issue. Follow our guide, and you will be ready in no time. Here is what you do for each possibility:
Fixing "Upload folder is not writable" in WordPressThis is the most commonly seen case (80% of the time). It can occur when trying to upload media or plugins and themes. The error message may also read: “Unable to create directory.” Most of the time, it happens after a WordPress site has been moved, migrated from a developer to your account, or moved from one web host to another. There is an upload path that is stored in the database. It's in order for WordPress to know where to put your files once you upload them in the WordPress Admin. When you migrate a site from one hosting account to another, that upload path is not going to be the same and therefore WordPress can not “write to that path”.
The error message may also read, “Unable to create directory…” To fix this, you need to:
Go to the WordPress Admin Board;Click on Settings;Click on Media;Look for Upload Files Section;Look for Store Uploads in this Folder;Replace what you have there with "wp-content/uploads" (remove the quotes);Click on Save Changes;Do the above and you are done with this case.
Fixing "The uploaded file cannot be moved to wp-content/(the upload folder)" via the cPanel TerminalGo to cPanel and open the Terminal. If you are not a tech-savvy person, do not worry, what you need to do in the Terminal is simple;After you have opened the Terminal, the next thing you will be doing is setting all your files and folders default permissions to 644/755. To do that, you need to go to the wp-content folder via the terminal command:cd /home/$USER/public_html/wp-contentFollow this by inputting the command line:find . -type d -print0 | xargs -0 chmod 0755 && find . -type f -print0 | xargs -0 chmod 0644it fixes all files and folders permissions to their default, including the uploads folder.Still in the Terminal, go to the public_html folder by using the command:cd /home/$USER/public_htmland then run:chown -R $USER: wp-contentdoing that will fix the ownership of all files and folders recursively.What you did should be enough to fix the issue. However, in case it does not, there is also a case where a theme/plugin could be causing the upload error message. Try disabling all plugins temporarily and upload your files again. If there are no issues now, it means that you know the source - a plugin or a theme. In case the error message “The uploaded file cannot be moved to wp-content/(the upload folder)” persists, the problem is probably on a server level and you should turn to our technical support team.Contact Us for AssistanceIn case you’ve done everything in your post, but your problem persists, feel free to open a support ticket. Our expert technical support staff works 24/7 and will be happy to investigate the issue for you further. Make sure to explain what you want, as well as everything you’ve already tried. This way, the team will act quickly, and the issue will be resolved in a more timely manner.
We hope you find this article useful. Discover more about FastCloud - the top-rated Hosting Solutions for personal and small business websites in four consecutive years by the HostAdvice Community!
Related articlesHow to Disable CSS and JavaScript Added by Plugins in WordPressHow to Embed Google Reviews in WordPressHow to Fix the Missed Schedule Post Error in WordPressHow to Transfer WordPress.com to WordPress.orgHow to Prevent Spam On Your WordPress Site